package net.lgpage.util;

import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

public class SubmitHandler extends Handler {

	
	public SubmitHandler() {
		super();
	}
	public static int SUBMIT = 17;
	Toast mToast;
	@Override
	public void handleMessage(Message msg) {
		if(msg.what == SUBMIT){
			Button bt = (Button) msg.obj;
			if(bt!=null)
			bt.setEnabled(true);
		}
		super.handleMessage(msg);
	}
	
	public void preventSubmit(View bt){
		if(bt == null){
			return;
		}
		bt.setEnabled(false);
		Message msg = new Message();
		msg.obj = bt;
		msg.what=SUBMIT;
		this.sendMessageDelayed(msg, 2000);
	}
	
}
